<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <title>系统登录</title>
    <link rel="stylesheet" type="text/css" href="layui/css/Login.css" />
</head>

<body>
    <div id="login">
        <h1>系统登陆</h1>
        <form method="post" action="/juge">
            <input type="text" required="required" placeholder="用户名" name="username" id="username"></input>
            <input type="password" required="required" placeholder="密码" name="password"></input>
            <button class="but" type="submit">登录</button>
        </form>
    </div>
    <script src="layui/jquery-3.5.1.min.js"></script>
    <script>
        $("form").submit(function(e) {
            $.ajax({
                    url: "http://localhost:8080/setUserName",
                    method: "post",
                    dataType: 'json',
                    data: {
                        'ruserName': $("#username").val(),
                    }
                })
                //alert("sss");
        });
    </script>
</body>

</html>